<!DOCTYPE html>
<html lang="en">
<head>
	<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
	<meta charset="UTF-8">
	<title>等待确认</title>
	<meta name="description" content="">
	<meta name="keywords" content="">
	<meta name="viewport" content="initial-scale=1, width=device-width, maximum-scale=1, user-scalable=no">
	<meta name="format-detection" content="telephone=no,email=no,adress=no" />
	<meta name="apple-mobile-web-app-capable" content="yes" />  
	<meta name="apple-mobile-web-app-status-bar-style" content="black">
	<link rel="stylesheet" href="{THEME_PATH}styles/swiper.min.css">
	<link rel="stylesheet" href="{THEME_PATH}styles/reset.css">
	<link rel="stylesheet" href="{THEME_PATH}styles/common.css">
	<link rel="stylesheet" href="{THEME_PATH}styles/style.css">	
	<script src="{THEME_PATH}js/jquery-1.8.3.min.js"></script>
	<script src="{THEME_PATH}js/swiper.min.js"></script>
	<script src="/statics/js/layer/layer.js"></script>
</head>
<body>
	<!-- S header -->
	<header>
		<a href="<?php echo U('index?type=1'); ?>" class="headerL iconfont">&#xe69f;</a>
		<h1>交易详情</h1>
	</header>
	<!-- E header -->

	<!-- S 交易状态 -->
	<dl class="my-deal-condition">
		<dt><img src="{THEME_PATH}images/icon-deal1.png" alt="" width="21">等待确认</dt>
		<!-- <dd><img src="{THEME_PATH}images/icon-deal2.png" alt="">02:59:28</dd> -->
		<dd id="time"></dd>
	</dl>
	<!-- E 交易状态 -->

	<!-- S 对方信息 -->
	<h2 class="my_deal_h2">对方信息</h2>
	<dl class="my_deal_user">
		<dt><img src="<?php echo $info['photo'] ? $info['photo'] : THEME_PATH.'images/user-my.png';?>" alt="" width="50" class="user_photo"></dt>
		<dd><?php echo $info['real_name'];?></dd>
	</dl>
	<ul class="my_deal_msg_items">
		<li class="flex flex-pack-justify">
			<div>真实姓名</div>
			<div class="asidR"><?php echo $info['real_name'];?></div>
		</li>		
		<li class="flex flex-pack-justify">
			<div>电话</div>
			<div class="asidR"><?php echo $info['username']; ?><img src="{THEME_PATH}images/icon-deal3.png" alt="" width="12" class="icon-deal3"></div>
		</li>
		<li class="flex flex-pack-justify">
			<div>微信</div>
			<div class="asidR"><?php echo $info['wx_account']; ?><img src="{THEME_PATH}images/icon-deal4.png" alt="" width="12.5" class="icon-deal4"></div>
		</li>
		<li class="flex flex-pack-justify">
			<div>支付宝</div>
			<div class="asidR"><?php echo $info['alipay_account']; ?><img src="{THEME_PATH}images/icon-deal4.png" alt="" width="12.5" class="icon-deal4"></div>
		</li>
	</ul>
	<!-- E 对方信息 -->
	<!-- S 订单信息 -->
	<h2 class="my_deal_h2">订单信息</h2>
	<ul class="my_deal_msg_items">
		<li class="flex flex-pack-justify">
			<div>数量</div>
			<div class="asidR"><?php echo $info['number']; ?> GF</div>
		</li>
		<li class="flex flex-pack-justify">
			<div>单价</div>
			<div class="asidR"><?php echo $info['price']; ?>CNY</div>
		</li>
		<li class="flex flex-pack-justify">
			<div>总价</div>
			<div class="asidR"><?php echo $info['all_price']; ?> CNY</div>
		</li>
		<li class="flex flex-pack-justify">
			<div>时间</div>
			<div class="asidR"><?php echo $info['time'];?></div>
		</li>
	</ul>

	
	<!-- E 订单信息 -->
	<!-- S 转账信息 -->
	<h2 class="my_deal_h2">转账信息</h2>
	<!-- 上传凭证 -->
	<!-- <div class="uploading-proof userImg" id="header_file"> -->
	<div class="userImg alignC" id="header_file">
	<dd>
					<a href="javascript:;" class="inline_block"><img  src="<?php $order_info = M('hang_buy')->where(['id'=>$order_info['id']])->find();
					echo $order_info['pay_image'] ? $order_info['pay_image'] : THEME_PATH.'images/uploading.png'; ?>" alt="" width="100%" class="uploading_img"></a>
					<input type="file" id="file_up" name="上传" style="display:none;"/>
	</dd>	
			
	</div>
	<!-- <ul class="my-centre-item personal-details-item">
		<li>
			<a href="javascript:;" class="flex flex-pack-justify">
				<div class="userImg" id="header_file">
			
					<img src="{THEME_PATH}images/icon-tx1.png" alt="" width="17.5" height="17.5" class="icon-my">
					上传头像 
					<input type="file" id="file_up" name="上传" style="display:none;"/>
				</div>
				<div class="right tx">
					<img src="<?php echo $user_info['photo'] ? $user_info['photo'] : THEME_PATH.'images/user-my.png'; ?>" alt="" width="100%">
				
				</div>
			</a>
		</li>
	</ul> -->

	<ul class="deal-btns-wrap flex flex-pack-justify">
		<li><a href="javascript:;" onclick="complainBtn()">举报</a></li>
		<li><a href="javascript:;" class="submit">提交订单</a></li>
	</ul>

	<div class="popup_shade"></div>
	<!-- S 举报 -->
	<div class="complain_popUp">
		<h2 class="title alignC">请输入举报理由</h2>
		<textarea name="buy_content" class="text" placeholder="请输入举报理由" id="text"></textarea>
		<a href="javascript:;" class="btn">提交</a>
	</div>
	<!-- E 举报 -->

	
	<link href="/statics/js/webuploader/webuploader.css" rel="stylesheet" />
	<script src="/statics/js/webuploader/webuploader.js" type="text/javascript"></script>
	<script type="text/javascript">
        $(function(){
            countDown(<?php echo $order_info['time']?>);
        })
    </script>
<script type="text/javascript">
    var uploader = WebUploader.create({
        auto:true,
        fileVal:'upfile',
        // swf文件路径
        swf: '/statics/js/webuploader/webuploader.swf',
        // 文件接收服务端。
        server: "/index.php?m=attachment&c=upload&a=swfupload",
        // 选择文件的按钮。可选
        formData:{
            "module":"",
            "catid":"",
            "userid":"1",
            "dosubmit":"1",
            "thumb_width":"0",
            "thumb_height":"0",
            "watermark_enable":"1",
            "filetype_post":"jpg|jpeg|gif|bmp|png",
            "swf_auth_key":"57a39f6f7415ec2cdd2b8afd77b57c3f",
            "isadmin":"1"
        },
        // 内部根据当前运行是创建，可能是input元素，也可能是flash.
        pick: {
            id: '#header_file',
            multiple:false
        },
        accept:{
            title: '图片文件',
            extensions: 'gif,jpg,jpeg,bmp,png',
            mimeTypes: 'image/*'
        },
        thumb:{
            width: '110',
            height: '110',
        },
        chunked: false,
        chunkSize:1000000,
        // 不压缩image, 默认如果是jpeg，文件上传前会压缩一把再上传！
        resize: false
    });
    uploader.onUploadSuccess = function( file, response ) {
        var pickid = this.options.pick.id;
        var data = response._raw;
        var arr = data.split(',');
        if(response.url.length > 0) {
            $(pickid).find('img').attr('src', response.url);
            $(pickid).find('input[type=hidden]').eq(0).attr('value', response.url);
        }
		var id = <?php echo $order_info['id']; ?>;
        $.post(
			"/index.php?m=user&c=upload&a=upload_user_avatar_wap3",
			// data:{id:id},
			{img_url : response.url,id:id},
			function(data){
				// console.log(data);
				if (data.status == 1) {
					location.reload();
				}else{
					hd_alert(data.info);
					if (data.url) {
						location.href = data.url;
						return false;
					}
					location.reload();
				}
       	 	},'json'
		)
    }
    uploader.onUploadError = function(file, reason) {
        hd_alert('文件上传错误：' + reason);
    }
</script>
	<script>

		//举报
		function complainBtn(){
			$(".popup_shade,.complain_popUp").show();
			

		}

		$('.btn').click(function(){
			
				var buy_content = $('#text').val();
				// console.log(buy_content);
				if(!buy_content){
					layer.msg('请输入举报内容');
					setTimeout(function(){
								location.reload();
							},1000);
					return false;
				}
				var type ='buy';
				var id = <?php echo $order_info['id'];?>;
				$.ajax({
					url:"/index.php/?m=user&c=order&a=jubao",
					type:'post',
					data:{buy_content:buy_content,id:id,type:type},
					dataType:'json',
					success:function(data){
						
					
						if(data.status ==0){
							// console.log(data.info);
							// return;
							layer.msg(data.info);
							setTimeout(function(){
								location.reload();
							},1000);
						}else{
			
							// $(".popup_shade,#payment_popUp").hide();
							// $(".popup_shade,#success").show();
							layer.msg(data.info);

							setTimeout(function(){
        					// location.href = "/index.php?m=user&c=trade&a=index";
							window.location.reload();
    						},1000);
					
							// layer.close(index);
							return;
						}
					}
				});
				layer.close();
		})
		$('.submit').click(function(){
			var img = "<?php echo $order_info['pay_image'];?>";
			console.log(img);
			if(img){
				layer.msg('操作成功');
			}else{
				layer.msg('请先上传支付凭证');
			}
		})

		function countDown(times){
			console.log(times);
			var timer=null;
			timer=setInterval(function(){
				var day=0,
				hour=0,
				minute=0,
				second=0;//时间默认值
				if(times > 0){
				// day = Math.floor(times / (60 * 60 * 24));
				hour = Math.floor(times / (60 * 60)) - (day * 24);
				minute = Math.floor(times / 60) - (day * 24 * 60) - (hour * 60);
				second = Math.floor(times) - (day * 24 * 60 * 60) - (hour * 60 * 60) - (minute * 60);
				}
				// if (day <= 9) day = '0' + day;
				if (hour <= 9) hour = '0' + hour;
				if (minute <= 9) minute = '0' + minute;
				if (second <= 9) second = '0' + second;
				$("#time").html("倒计时&nbsp;"+hour+":"+minute+":"+second);
				// console.log(hour+":"+minute+":"+second);
				times--;
			},1000);
			if(times<=0){
				// $("#time").html("倒计时&nbsp;00:00:00");
				clearInterval(timer);
			}
		}
		
	</script>
</body>
</html>